#include<stdio.h>
float calMoney(int len)
{
	if (len >= 60)return (len - 60) * 3 + (60 - 40)*1.5 + 40;
	else if (len > 40 && len < 60)return (len - 40) * 1.5 + 40;
	else return len;
}
int main()
{
	float len, salary;
	while (scanf("%f %f", &len, &salary) != EOF)
	{
		if (len < 0 || salary < 0 || len > 24 * 7)printf("input is wrong!\n");
		else printf("%g\n", calMoney(len)*salary);
	}
	return 0;
}